import csv
import os, fnmatch

def find(name, path):
    for root, dirs, files in os.walk(path):
        if name in files:
            return os.path.join(root, name)

def find_all(name, path):
    result = []
    for root, dirs, files in os.walk(path):
        if name in files:
            result.append(os.path.join(root, name))
    return result

def find_pattern(pattern, path):
    result = []
    for root, dirs, files in os.walk(path):
        for name in files:
            if fnmatch.fnmatch(name, pattern):
                result.append(os.path.join(root, name))
    return result
    #find('*.txt', 'c:\\')
    
def read_csv(filename):
    ifile  = open(filename, "rb")
    reader = csv.reader(ifile, delimiter = ",")
    data = []
    for row in reader:
        data.append(row)
    return data
    ifile.close()

def trim(string):
    return string.strip()
        
